#ifndef __OMGW_APPLICATION_H
#define __OMGW_APPLICATION_H

#include <OgreRoot.h>

#include "NxPhysics.h"
#include <OIS/OIS.h>
#include "SettingsManager.h"
#include "Session.h"

#include "Menu.h"

#include <CEGUI/CEGUI.h>
#include <OgreCEGUIRenderer.h>

//forward class declarations
class OMGCamera;
class EventListener;
class Ogre::RenderWindow;


//global variables
extern SettingsManager gSettings;
extern Ogre::SceneManager* gSceneMgr;
extern OMGCamera* gCamera;


// Physics SDK globals
extern NxPhysicsSDK* gPhysicsSDK;
extern NxScene*		gScene;
extern NxVec3	    gDefaultGravity;

// Actor globals
extern NxActor* groundPlane;

// Focus actor
extern NxActor* gSelectedActor;


class Application
{
public:
    void go();

    ~Application();

    Ogre::Root *mRoot;
    OIS::Keyboard *mKeyboard;
    OIS::Mouse *mMouse;
    OIS::InputManager *mInputManager;
    CEGUI::OgreCEGUIRenderer *mRenderer;
    CEGUI::System *mSystem;
    EventListener* mListener;
	Ogre::RenderWindow* mRenderWindow;

	CEGUI::Window* mSheet;

	Menu* mMenu;
	CreditsMenu* mCreditsMenu;
	HighscoresMenu* mHighscoresMenu;
	Play_GameMenu* mPlay_GameMenu;
	ExitMenu* mExitMenu;
	
	Session* mSession;

    void createRoot();
    void defineResources();
    void setupRenderSystem();
    void createRenderWindow();
    void initializeResourceGroups();
    void setupScene();
    void setupInputSystem();
    void setupCEGUI();
    void createFrameListener();
    void startRenderLoop();
};

extern Application* gApplication;

#endif
